<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script type="text/javascript">
description("This tests webkitStorageInfo API works.");

function errorCallback(error)
{
    testFailed("Error occurred: " + error);
    finishJSTest();
}

var returnedUsage;
var returnedQuota;
function usageCallback(usage, quota)
{
    returnedUsage = usage;
    returnedQuota = quota;

    // Quota value would vary depending on the test environment.
    shouldBeGreaterThanOrEqual("returnedUsage", "0");
    shouldBeGreaterThanOrEqual("returnedQuota", "returnedUsage");

    finishJSTest();
}

if (window.webkitStorageInfo) {
    window.jsTestIsAsync = true;
    webkitStorageInfo.queryUsageAndQuota(webkitStorageInfo.TEMPORARY, usageCallback, errorCallback);
} else {
    debug("This test requires window.webkitStorageInfo.");
}
</script>
</body>
</html>
